<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <button>点击获取跨域资源</button>
</body>
<script>
let btn = document.querySelector("button");

function cbfn(res){
    console.log(res);
}
btn.onclick = function(){
    let o = document.createElement("script");
    o.src = "http://localhost:4000/getAjax?cb=cbfn";
    document.querySelector("head").appendChild(o);

    // console.log(a);
    // o.onload = function(){
    //     console.log(a);
    // }
}

</script>
</html>